package com.itheima.mycountdownlatch.腾讯会议;

import java.util.concurrent.CountDownLatch;

public class Demo {
    public static void main(String[] args) throws InterruptedException {
        //创建线程计数器countDownLatch
        CountDownLatch countDownLatch = new CountDownLatch(4);

        //创建子线程
        ChileThread c1 = new ChileThread(countDownLatch);
        c1.setName("马云");
        ChileThread c2 = new ChileThread(countDownLatch);
        c2.setName("马化腾");
        ChileThread c3 = new ChileThread(countDownLatch);
        c3.setName("王兴");
        ChileThread c4 = new ChileThread(countDownLatch);
        c4.setName("张一鸣");

        c1.start();
        c2.start();
        c3.start();
        c4.start();

        //await()会导致程序进入阻塞状态,等到countDownLatch计数器到0后才会被唤醒,继续向下执行
        countDownLatch.await();
        System.out.println("老板都到了,会议开始");
    }
}
